﻿<%@ Page Title="" Language="C#" MasterPageFile="~/skin.Master" AutoEventWireup="true" CodeBehind="Online.aspx.cs" Inherits="DataShow.Online" %>
<%@ Register Src="/ascx/AddPanel2.ascx" TagName="NUD" TagPrefix="UC" %>
<asp:Content ID="Content1" ContentPlaceHolderID="home_header" runat="server">
    <link href="/css/lib/bootstrap.datepicker.css" type="text/css" rel="stylesheet" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cph_home" runat="server">
    <div style="margin-top: 10px;">
        <ul class="breadcrumb">
            <li><a href="<%:IndexUrl %>">首页</a> <span class="divider">/</span></li>
            <li class="active">天气在线编辑</li>
        </ul>
    </div>

    <div class="modal-body" style="max-height: 1000px;">
        <div class="field-box inline">
            <label>发报日期:</label>
            <asp:TextBox runat="server" ID="txt_add_time" CssClass="input-large datepicker" />
        </div>
        <div class="field-box inline">
            <label>发报时刻:</label>
            <asp:DropDownList runat="server" ID="ddl_send_point">
                <asp:ListItem Text="06时" Value="H06"></asp:ListItem>
                <asp:ListItem Text="10时" Value="H10"></asp:ListItem>
                <asp:ListItem Text="16时" Value="H16"></asp:ListItem>
            </asp:DropDownList>
        </div>

        <ul id="myTab" class="nav nav-tabs">
            <li class="active"><a href="#home" data-toggle="tab">连云港</a></li>
            <li><a href="#profile" data-toggle="tab">东海</a></li>
            <li><a href="#yg" data-toggle="tab">赣榆</a></li>
            <li><a href="#gy" data-toggle="tab">灌云</a></li>
            <li><a href="#gn" data-toggle="tab">灌南</a></li>
        </ul>
        <div id="myTabContent" class="tab-content">
            <div class="tab-pane fade in active data_table" id="home">
               <UC:NUD runat="server" ID="und_lyg" StationCode="58044" />
            </div>
            <div class="tab-pane fade data_table" id="profile">
                <UC:NUD runat="server" ID="und_dh" StationCode="58036" />
            </div>
            <div class="tab-pane fade data_table" id="yg">
                <UC:NUD runat="server" ID="und_gy" StationCode="58040" />
            </div>
            <div class="tab-pane fade data_table" id="gy">
                <UC:NUD runat="server" ID="und_guanyun" StationCode="58047" />
            </div>
            <div class="tab-pane fade data_table" id="gn">
                <UC:NUD runat="server" ID="und_gn" StationCode="58048" />
            </div>
        </div>
        <input type="hidden" id="station_code" runat="server" class="station_code" value="#home" />
    </div>
    <div class="modal-footer">
        <asp:LinkButton runat="server" OnClick="Unnamed_Click" Text="加载本时刻预报"  style="float:left" />
        <asp:Button runat="server" ID="btn_save" Text="保存" CssClass="btn-primary btn" OnClick="btn_save_Click" />
        <input type="button" class="btn btn-info btn_sync" runat="server" value="一致" id="btn_sync" /> 
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="home_script" runat="server">
    <script src="/js/bootstrap.datepicker.js"></script>
    <script type="text/javascript">
        $(function () {
            $('.datepicker').datepicker({ format: 'yyyy-mm-dd' }).on('changeDate', function (ev) {
                $(this).datepicker('hide');
            });

            //$(".txtnumber").val('1.0');
            if ($(".txtnumber").val() == "") {
                $(".txtnumber").val('1.0');
            }
            $(".btnup").click(function () {
                var $textbox = $(this).parent().siblings(".txtnumber");
                $textbox.val(Math.round((parseFloat($textbox.val()) + 0.1) * 100) / 100);
            })
            $(".btndown").click(function () {
                var $textbox = $(this).parent().siblings(".txtnumber");
                $textbox.val(Math.round((parseFloat($textbox.val()) - 0.1) * 100) / 100);
            })
        })

        $('a[data-toggle="tab"]').on('shown', function (e) {
            var station = $(e.target).attr("href");
            $(".station_code").val(station);
        })


        //同步
        $(".btn_sync").click(function () {
            var $inputs = $($(".station_code").val()).find("input[type='text'],select");
            $(".data_table").each(function () {
                if ("#" + $(this).attr("id") != $(".station_code").val()) {
                    var $newinputs = $(this).find("input[type='text'],select");
                    for (var i = 0; i < $inputs.length; i++) {
                        console.log($inputs.eq(i).val())
                        $newinputs.eq(i).val($inputs.eq(i).val());
                    }
                }
            })
        })

    </script>
</asp:Content>
